<!-- 我的表格 -->

<template>
  <WebTable>
    <RowIndex />

    <RowTitle label="设备编号" bind="deviceDto.deviceCode" :width="120" />

    <RowText label="设备名称" bind="deviceDto.deviceName" :minWidth="100" />

    <RowText label="设备类型" bind="terminalType" />

    <!-- <RowTree
      :label="`所在${CORE.MAP.REGION}`"
      bind="deviceDto.areaId"
      :dict="CORE.REGION.DICT"
      allName
      :minWidth="140"
    /> -->

    <RowDict label="终端属性" bind="settingType" :dict="DICT.PROP" />

    <RowText label="IP 地址" bind="deviceDto.ipAddress" />

    <RowText label="当前任务" bind="task" :minWidth="140" empty="-" />

    <RowStatus label="在离线" bind="deviceDto.status" :dict="CORE.DICT.STATUS_ONLINE_DEVICE" :width="80" />

    <RowNum label="下载进度" bind="downPosition" suffix="%" :width="100" />

    <RowOperate>
      <template #default="{ row }">
        <BtnText :title="CORE.MAP.TIP_SHOW" @click="windowDetail(row)" />

        <BtnText :title="MAP.SUBMIT" @click="toPhoto(row)" />

        <el-dropdown placement="bottom-start" @command="(command) => toOperate(command, row)">
          <BtnText><span>操作</span><i class="el-icon-caret-bottom" /></BtnText>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item command="Del">{{ MAP.DEL }}</el-dropdown-item>
              <el-dropdown-item command="Pass">{{ MAP.PASS }}</el-dropdown-item>
              <el-dropdown-item command="Rej">{{ MAP.REJ }}</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </template>
    </RowOperate>
  </WebTable>
</template>

<script>
// ============================== 导入依赖 ============================== //

import mixDetailToTable from '@admin/components/detail/mixDetailToTable'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyTable',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [mixDetailToTable('', 'DetailShihanDevice')],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 点击截图
     */
    toPhoto(row) {
      this.setOne(row)
      this.startSubmit()
    },

    /**
     * 点击操作
     */
    toOperate(method, row) {
      this[`open${method}`](row)
    },
  },
}
</script>
